<template>
	<view class="container">
		<view class="list">
			<view v-for="(item,index) in list" class="item row">
				<view @click="goDetail(item,index)">
					<view class="col-12">
						<view>巡检单号：{{item.seqNo}}</view>
					</view>
					<view class="col-12">
						<view>健身设施：{{item.desFitnessFacilities}}</view>
					</view>
					<view class="col-12">
						<view>雨污水井：{{item.desRainwaterWells}}</view>
					</view>
					<view class="col-12">
						<view>水箱间：{{item.desWaterTank}}</view>
					</view>
					<view class="col-12">
						<view>变电所：{{item.desSubstation}}</view>
					</view>
					<view class="col-12">
						<view>公共照明：{{item.desPublicLighting}}</view>
					</view>
					<view class="col-12">
						<view>路面：{{item.desPavement}}</view>
					</view>
					<view class="col-12">
						<view>公共区域：{{item.desPublicAreas}}</view>
					</view>
					<view class="col-12">
						<view>楼宇门：{{item.desBuildingDoors}}</view>
					</view>
					<view class="col-12">
						<view>泵房：{{item.desPumpRoom}}</view>
					</view>
					<view class="col-12">
						<view>儿童游乐场：{{item.desPlayground}}</view>
					</view>
					<view class="col-12">
						<view>创建者：{{item.createBy}}</view>
					</view>
					<view class="col-12">
						<view>创建时间：{{item.createTime}}</view>
					</view>
					<view class="col-12">
						<view>更新者：{{item.updateBy}}</view>
					</view>
					<view class="col-12">
						<view>更新时间：{{item.updateTime}}</view>
					</view>
					<view class="col-12">
						<view>小区编号：{{item.block}}</view>
					</view>
					<view class="col-12">
						<view>备注：{{item.remark}}</view>
					</view>
				</view>
				<button @click="deleteIt(item,index)" size="mini" type="primary" style="float: right;">删除</button>
			</view>
			<button class="sendBtn" @click="addInfo()">+</button>
		</view>
	</view>
</template>
<script>
	import {
		flowInspectionDaySelect,
		flowInspectionDayDelete
	} from "@/api/home.js"
	export default {
		data() {
			return {
				list: [],
				queryParams: {
					// resourceName: '',
					pageNum: 1,
					pageSize: 10,
					total: 0,
					lastModifyTime1: '',
					lastModifyTime2: ''
				},
				todayDate: '',
			}
		},
		onPullDownRefresh() {
			// 下拉刷新
			this.queryParams.pageNum = 1;
			this.list = [];
			this.getList();
		},
		onReachBottom() {
			// 上拉加载更多
			if (this.queryParams.total > this.list.length) {
				this.queryParams.pageNum++;
				this.getList();
			} else {
				uni.showToast({
					title: "没有数据了",
					icon: "none"
				})
			}
		},
		onLoad() {
			this.queryParams.currentPage = 1;
			this.list = [];
			this.getList();
		},
		methods: {
			goDetail(item) {
				uni.navigateTo({
					url: "./add?item=" + JSON.stringify(item)
				})
			},
			deleteIt(item, index) {
				let that = this
				uni.showModal({
					title: "提示",
					content: "是否删除",
					success(res2) {
						if (res2.confirm == true) {
							flowInspectionDayDelete({
								...item
							}).then(res => {
								console.log(res);
								that.list = [];
								that.getList()
							})
						}
					}
				})
			},
			addInfo() {
				uni.navigateTo({
					url: "/pages/home/mrxj/add"
				})
			},
			getList() {
				var data = this.queryParams
				console.log('data', data)
				flowInspectionDaySelect(data).then(res => {
					uni.stopPullDownRefresh();
					console.log('resres', res)
					if (res.code == 200) {
						this.list = this.list.concat(res.rows);
						this.total = res.total;
					}
				}).catch(err => {
					uni.stopPullDownRefresh();
				})
			},

		}
	}
</script>

<style lang="scss" scoped>
	.list {
		width: 100%;
		overflow: hidden;

		.item {
			width: calc(100vw - 44px);
			overflow: hidden;
			padding: 10px;
			margin: 10px;
			border: 2px solid #81b0ff;
			border-radius: 8px;
			background-color: #ffffff;
			box-shadow: 2px 2px 5px 0px #035883;
		}

		.item:last-child {
			border: none;
		}
	}

	.sendBtn {
		position: fixed;
		bottom: 40px;
		right: 50px;
		width: 50px;
		height: 50px;
		line-height: 50px;
		text-align: center;
		border-radius: 50px;
		border: none;
		background: #00aaff;
		color: #fff;
		font-size: 30px;
	}

	.row {
		width: 100%;
		overflow: hidden;
	}

	.col-12 {
		width: 50%;
		float: left;
	}

	.picker-container {
		height: 80rpx;
		font-size: 26rpx;
		display: flex;
		justify-content: space-around;
		align-items: center;
		border-radius: 10rpx;
		background-color: #fff;
	}

	.picker-item {
		padding: 16rpx;
		display: flex;
		justify-content: space-around;
		align-items: center;
	}

	.picker-item-title {
		color: #999;
		white-space: nowrap;
	}

	.picker-item picker {
		flex: 1;
		color: #00aaff;
		font-weight: bold;
	}

	.button {
		width: 15%;
		height: 33px;
		font-size: 13px;
		float: right;
		background-color: #00aaff;
		color: #fff;
	}
</style>